using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;

namespace Clothes.Model
{
    public partial class ClothesContext : DbContext
    {
        public ClothesContext()
            : base("name=ClothesContext")
        {
        }

        public virtual DbSet<CLClassify> CLClassify { get; set; }
        public virtual DbSet<CLDress> CLDress { get; set; }
        public virtual DbSet<CLLogin> CLLogin { get; set; }
        public virtual DbSet<CLUser> CLUser { get; set; }
        public virtual DbSet<shopping> shopping { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<CLClassify>()
                .Property(e => e.Category)
                .IsUnicode(false);

            modelBuilder.Entity<CLClassify>()
                .HasMany(e => e.CLDress)
                .WithRequired(e => e.CLClassify)
                .HasForeignKey(e => e.TypeId)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<CLDress>()
                .Property(e => e.Avatar)
                .IsUnicode(false);

            modelBuilder.Entity<CLDress>()
                .Property(e => e.Summary)
                .IsUnicode(false);

            modelBuilder.Entity<CLDress>()
                .Property(e => e.Price)
                .HasPrecision(5, 2);

            modelBuilder.Entity<CLLogin>()
                .Property(e => e.UserName)
                .IsUnicode(false);

            modelBuilder.Entity<CLLogin>()
                .Property(e => e.MobileNumber)
                .IsUnicode(false);

            modelBuilder.Entity<CLLogin>()
                .Property(e => e.Password)
                .IsUnicode(false);

            modelBuilder.Entity<CLUser>()
                .Property(e => e.NickName)
                .IsUnicode(false);

            modelBuilder.Entity<CLUser>()
                .Property(e => e.Avatar)
                .IsUnicode(false);

            modelBuilder.Entity<CLUser>()
                .Property(e => e.Address)
                .IsUnicode(false);

            modelBuilder.Entity<CLUser>()
                .Property(e => e.MobileNumber)
                .IsUnicode(false);

            modelBuilder.Entity<shopping>()
                .Property(e => e.Avatar)
                .IsUnicode(false);

            modelBuilder.Entity<shopping>()
                .Property(e => e.Summary)
                .IsUnicode(false);
        }
    }
}
